UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K+deXdYTNCi1VT6+PPBN4IM+9MUuqBW6W/tafJb9Z3Q=' 
WHERE 
  key_id = 'ca2efe8ae892ef352a9459a87796b933d17ae112386df11f5fd6d92fa041588a' 
  AND (
    token = 'K+deXdYTNCi1VT6+PPBN4IM+9MUuqBW6W/tafJb9Z3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040