UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1E3i3TzUiXpihns3ZJk9u+763lKVu4fvW3STELQ62wI=' 
WHERE 
  key_id = '7b31f8c228f868deeb0cdc7fe859e8c1712eabe12a278426dd9e0b8848061248' 
  AND (
    token = '1E3i3TzUiXpihns3ZJk9u+763lKVu4fvW3STELQ62wI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047