UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fiDSQQr6xZDyVHj3FtWwj+c+xTt8n7RNnd8dxYRDIco=' 
WHERE 
  key_id = 'c7b52aa8a8e2e70a817b383001b9c5039247994356b9853bd58f5ec57b7b89fd' 
  AND (
    token = 'fiDSQQr6xZDyVHj3FtWwj+c+xTt8n7RNnd8dxYRDIco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027