UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0VsbdFN1jX51zDJ8XasbK5fHnIzOCu+2HpqaQtkM4Cc=' 
WHERE 
  key_id = 'a144ef1b437168318430a67db86dc8192df3a1650aeaf488815e4185b79df962' 
  AND (
    token = '0VsbdFN1jX51zDJ8XasbK5fHnIzOCu+2HpqaQtkM4Cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042