UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cSGSOgQKK3FuBxONzJmVeOxImbgE1S3Y+8L8yZBy4Wo=' 
WHERE 
  key_id = '096ef7d6ac53b4cdacf9c2d6df87e9023799d6e3dc743f815cffa110c1718343' 
  AND (
    token = 'cSGSOgQKK3FuBxONzJmVeOxImbgE1S3Y+8L8yZBy4Wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019