UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't0nynxJFjbgX5+M+39KmaokspFI+pegsiQ3o6Bgmid0=' 
WHERE 
  key_id = '3b892d759a824355aac2f8308b3f9434a90196123e046d8292a8c1a6652f0293' 
  AND (
    token = 't0nynxJFjbgX5+M+39KmaokspFI+pegsiQ3o6Bgmid0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026