UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'boruJjs0WpzurCklf83/+VxCOBVbzFUIQOhGE/GY+38=' 
WHERE 
  key_id = '7f4d05d0e3229f370038ce67572f80c6b970a822f063751f72252982787c0f6b' 
  AND (
    token = 'boruJjs0WpzurCklf83/+VxCOBVbzFUIQOhGE/GY+38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038