UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cXpdhKol4duER0i0w/OJvCUumx11ZfwSyw7m6ZqidbY=' 
WHERE 
  key_id = 'f810ebe36067869c3708e9cac0b9ebc57cceb666d6d77a23a82aca14ff04941a' 
  AND (
    token = 'cXpdhKol4duER0i0w/OJvCUumx11ZfwSyw7m6ZqidbY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019