UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dVJ5LDO2Syowoya/o6yudBA2SD1xUEyWKnpunnDYqv4=' 
WHERE 
  key_id = '166165b64e4a258cc28e91b6cc16a4c0c700e3f70ffb07df5313d56d6997b9b0' 
  AND (
    token = 'dVJ5LDO2Syowoya/o6yudBA2SD1xUEyWKnpunnDYqv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037