UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i+Rc0ZJbse7tG40qIM8ELpm5YsFyOi5OedgXwl30jDY=' 
WHERE 
  key_id = 'b9e2e691fd6b078bd085946c60de38af0f49e497bbef86fb64b47a2e957e973b' 
  AND (
    token = 'i+Rc0ZJbse7tG40qIM8ELpm5YsFyOi5OedgXwl30jDY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032