UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bJAGsX2PhpbH9pZ8cZkPfftj+WamKE1cIpNY9X7dXuI=' 
WHERE 
  key_id = '0c36a59cf1f4412e55baf309f2f65a277425f7d366aaabfcb929c00fc9661759' 
  AND (
    token = 'bJAGsX2PhpbH9pZ8cZkPfftj+WamKE1cIpNY9X7dXuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025