UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hurNIGiC8pW9nP9PvwjSe6D0VvVgxw3bZnXV+f0xHPQ=' 
WHERE 
  key_id = '16bcc6cf84f2f23c26d1fc429c029a098d7b5f8322f8aeeb663056632e876aa1' 
  AND (
    token = 'hurNIGiC8pW9nP9PvwjSe6D0VvVgxw3bZnXV+f0xHPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026