UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X6DYHjs5ad+a+tsrdTqzuEYaVRYYr5gOBfWMuU9ge8M=' 
WHERE 
  key_id = '88af3b211d710045b03d8b37c81d9d66417adf218fc0a05829a144b80d6611e1' 
  AND (
    token = 'X6DYHjs5ad+a+tsrdTqzuEYaVRYYr5gOBfWMuU9ge8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043