UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J0QOAiLzVCjGuWq+DZoG2u7sIsbWJ4oJ6SV8AU36l4s=' 
WHERE 
  key_id = '5f919c41b76400a0fa768d2eab577d91b188ed777c5ef6c43aa63916ddcc9cc6' 
  AND (
    token = 'J0QOAiLzVCjGuWq+DZoG2u7sIsbWJ4oJ6SV8AU36l4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035