UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 300, 
  token = 'S0RqinjXl7MFWToZ4Znig4jUjLK0RfrJsbQDjKpVjDg=' 
WHERE 
  key_id = '693522a166f793df95c5226a1e21323c97740bbd9a0050179b5a9b33c4f44414' 
  AND (
    token = 'S0RqinjXl7MFWToZ4Znig4jUjLK0RfrJsbQDjKpVjDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040