UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oxv81kEbhqRQx+6A05Q1Z6Zm06nCLHxkUnC0gHsKgVs=' 
WHERE 
  key_id = '1c90cd5525238393bcc5e435f164c3aad380324df3f7cab1e1dcb3325c0a74b8' 
  AND (
    token = 'oxv81kEbhqRQx+6A05Q1Z6Zm06nCLHxkUnC0gHsKgVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035