UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fotY9gmyej0PXRg1+yH9JFs5in+IQBcv+EC27lifgek=' 
WHERE 
  key_id = 'fc59187cc7fa4ee6d079e406597f3db38b8bda098bb2cfc04a9dc2f12058339d' 
  AND (
    token = 'fotY9gmyej0PXRg1+yH9JFs5in+IQBcv+EC27lifgek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043