UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZuidJXfX8p0fv2787pPfIdIqs63JW0HhlXfZ0uLuzmc=' 
WHERE 
  key_id = 'c59645328571ab2f9225e9cb52803e0175337cb67bc287d4580952d8911b3152' 
  AND (
    token = 'ZuidJXfX8p0fv2787pPfIdIqs63JW0HhlXfZ0uLuzmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022