UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PIp8eFVbjr5MGJEovFNuiQH3aCBerpzadmutJLXhgbg=' 
WHERE 
  key_id = '424a6d2474f6afd8106361c50e5bba472e1a5b70a83e31af1e58511d6542932b' 
  AND (
    token = 'PIp8eFVbjr5MGJEovFNuiQH3aCBerpzadmutJLXhgbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050