UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQy+aP4TRyLSWjJ/Df4TlRsk7QPnrnSPol1SkOVi2LY=' 
WHERE 
  key_id = '30277806f130e2254271e5301b4e5248a52895abd356ecba796428828ecaeb47' 
  AND (
    token = 'bQy+aP4TRyLSWjJ/Df4TlRsk7QPnrnSPol1SkOVi2LY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030