UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q5JVw4PPqa5nf60jeOd9HGMqy+wWOgsAG96G0ZKnQvw=' 
WHERE 
  key_id = '0de9db9bc428fbb3c471c292e24722aa95e717592a34365c931c089d8517a2b1' 
  AND (
    token = 'q5JVw4PPqa5nf60jeOd9HGMqy+wWOgsAG96G0ZKnQvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019