UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0uD8d9NUSpSMoGmWDuKG7D+37GV/JVKkqEh52BsG8Ys=' 
WHERE 
  key_id = '17f4320e46a2028f69a57d04f19ba2f81c018d92cf581c831636001e71f1865e' 
  AND (
    token = '0uD8d9NUSpSMoGmWDuKG7D+37GV/JVKkqEh52BsG8Ys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029