UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JVwRW/YnFZiECWMImstDsragYMB8hTO8tsGgGf09fcw=' 
WHERE 
  key_id = '221db6067b965a749e40d8c9edbaff3b45bdf6072f7476b6c9352d167c33afd5' 
  AND (
    token = 'JVwRW/YnFZiECWMImstDsragYMB8hTO8tsGgGf09fcw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029