UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RW4+LKeeOO1AWwOUv3fbr+w1PzVGfD8I9D3ztimCO5E=' 
WHERE 
  key_id = 'b1eb2e8a51b7802eade18355ab9b6881cd1db69467f6d0b032a03c9fa60d9dda' 
  AND (
    token = 'RW4+LKeeOO1AWwOUv3fbr+w1PzVGfD8I9D3ztimCO5E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030