UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OJQewU4zWEAMQ2j8XAd4l3P7JgWzbn54iWrUVNF1+Aw=' 
WHERE 
  key_id = 'dc81c7512206c3f05a2ab31a084bd1fdf06114c92115440fcb8f7d041e53d80b' 
  AND (
    token = 'OJQewU4zWEAMQ2j8XAd4l3P7JgWzbn54iWrUVNF1+Aw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026