UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FNnrKGNO/1n9ZbejX7aGUPns88rzI3ISlwRCoFNdxGg=' 
WHERE 
  key_id = 'a4b0cb6955c4b720bb6216e72fa9be8aab878b965d5a1c79038371d941fddd0f' 
  AND (
    token = 'FNnrKGNO/1n9ZbejX7aGUPns88rzI3ISlwRCoFNdxGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038