UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CF5hWk5ZeUsQvDOsWWRnPR4mxTUFI6gyQ7CnrDN97gU=' 
WHERE 
  key_id = 'd4dec2b726025df6c8927948fe871865f632216ade1cd88fe08b2216c25ae4bc' 
  AND (
    token = 'CF5hWk5ZeUsQvDOsWWRnPR4mxTUFI6gyQ7CnrDN97gU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050