UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vk4OM5JtywV+CcvRjDDnkVyBJK7fzkYS+v2XWSuPhlY=' 
WHERE 
  key_id = '9aefc2d696a32e91e06b86a79d51064bf851e18e5b02d31fe367f7290097f1ec' 
  AND (
    token = 'Vk4OM5JtywV+CcvRjDDnkVyBJK7fzkYS+v2XWSuPhlY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033