UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Is5KR0CUd3zkc7rzYFFCSPcdz+uXBmXM5bDzhKJ1AS0=' 
WHERE 
  key_id = 'f033126f8486f5c3193437c88428531b70445e8a3adf647fc48110e3887c32e1' 
  AND (
    token = 'Is5KR0CUd3zkc7rzYFFCSPcdz+uXBmXM5bDzhKJ1AS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050