UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sAbTJ73Ql2fDZ2KPOUNGlHzuY7n0PdNikoAENis/Dfw=' 
WHERE 
  key_id = 'beac699e7f64587e4f326733e4f2b5f77d6039d95c3e71e516ac595f51ae020b' 
  AND (
    token = 'sAbTJ73Ql2fDZ2KPOUNGlHzuY7n0PdNikoAENis/Dfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043