UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dH1z+ACNzGkdg0TIemP/Za2bjjJ4DUIxYf26Bn0a0mk=' 
WHERE 
  key_id = '9cd334e966394ef7f999aa460afea63f272f6681324848efd61ee1bfbd476def' 
  AND (
    token = 'dH1z+ACNzGkdg0TIemP/Za2bjjJ4DUIxYf26Bn0a0mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023