UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mPUNasWN9d+rH+RHK+mSsEwsOJmw0BpMXlfEZgIwlEs=' 
WHERE 
  key_id = 'a0152ea019c6b669572d9ba9491029219b9490db161754b4071aefd7492c059f' 
  AND (
    token = 'mPUNasWN9d+rH+RHK+mSsEwsOJmw0BpMXlfEZgIwlEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044