UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oI4S7Y+j3IMpo07eZF8RwynNUhKB7k3O7bToiVUhoOU=' 
WHERE 
  key_id = '6e1e4d4f7e5a421874cce857dcbbe150bacbe1f1353725277c1c84ccd61b9604' 
  AND (
    token = 'oI4S7Y+j3IMpo07eZF8RwynNUhKB7k3O7bToiVUhoOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072