UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p9IoZTpuYAttwhPLC7Fl6ej5iFEUOMtZ3Fb777EDd9A=' 
WHERE 
  key_id = '51645cf3b81eb7c585086db3085465792e254781eabb2e6915ad9fc2826aba73' 
  AND (
    token = 'p9IoZTpuYAttwhPLC7Fl6ej5iFEUOMtZ3Fb777EDd9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030